#include <iostream>
using std::cout;
using std::endl;

void test0(){
    const int num = 10;
    const int * p = &num;
    /* int * p1 = (int*)p; */
    /* *p1 = 100; */
    
    //static_cast相比于C风格的类型转换
    //不安全的转换直接不允许
    //1.比较安全
    //2.方便查找
    /* int * p2 = static_cast<int*>(p); */
}

void test1(){
    int * p = (int*)malloc(sizeof(int));
    *p = 1;

    //<>中是目标类型
    //()中是待转换的内容
    int * p2 = static_cast<int*>(malloc(sizeof(int)));
    *p2 = 2;
}


int main(void){
    test0();
    return 0;
}
